Inside Macintosh: QuickTime Components

Previous | Chapter Top | Chapter Contents | Next

Utility Functions for Video Channel Callback Functions

Sequence grabber components provide a number of functions that your callback functions can use. This section describes those functions.

Use the SGGetBufferInfo function to obtain information about a buffer that contains data to be manipulated by your callback function.

The remaining functions described here provide default behavior for your callback functions.

SGGetBufferInfo

You can use the SGGetBufferInfo function to obtain information about a buffer that has been passed to your callback function.

pascal ComponentResult SGGetBufferInfo (SGChannel c,
                                         short bufferNum,
                                         PixMapHandle *bufferPM,
                                         Rect *bufferRect,
                                         GWorldPtr *compressBuffer,
                                         Rect *compressBufferRect);
c
Specifies the reference that identifies the channel for this operation.
bufferNum
Identifies the buffer. The sequence grabber component provides this value to your callback function.
bufferPM
Contains a pointer to a location that is to receive a handle to the pixel map that contains the image. Note that this pixel map may be offscreen. Do not dispose of this pixel map. If you do not want this information, set this parameter to nil .
bufferRect
Contains a pointer to a rectangle structure that is to receive the dimensions of the image's boundary rectangle. If you do not want this information, set this parameter to nil .
compressBuffer
Contains a pointer to a location that is to receive a pointer to the filter buffer for the image. The sequence grabber component returns this information only if your application has assigned a filter buffer to this video channel. You assign a filter buffer by calling the SGSetCompressBuffer function, which is described on SGSetCompressBuffer . Do not dispose of this buffer.
If you have not assigned a filter buffer, the sequence grabber sets the returned value to nil . If you do not want this information, set this parameter to nil .
compressBufferRect
Contains a pointer to a rectangle structure that is to receive the dimensions of the filter buffer for the image. The sequence grabber component returns this information only if your application has assigned a filter buffer to this video channel. You assign a filter buffer by calling the SGSetCompressBuffer function, which is described on SGSetCompressBuffer . If you have not assigned a filter buffer, the sequence grabber component returns an empty rectangle. If you do not want this information, set this parameter to nil .

RESULT CODE

paramErr

-50

Invalid parameter specified

SGGrabFrame

The SGGrabFrame function provides the default behavior for your grab function.

pascal ComponentResult SGGrabFrame (SGChannel c, short bufferNum);
c
Specifies the reference that identifies the channel for this operation. The sequence grabber component provides this value to your grab function.
bufferNum
Identifies the buffer. The sequence grabber component provides this value to your grab function.

SPECIAL CONSIDERATIONS

You should call the SGGrabFrame function only from your grab function. If you call it at any other time, results are unpredictable.

SEE ALSO

See "Application-Defined Functions," which begins on Application-Defined Functions , for information about grab-complete functions.

RESULT CODE

cantDoThatInCurrentMode

-9402

Request invalid in current mode

SGGrabFrameComplete

The SGGrabFrameComplete function provides the default behavior for your grab-complete function.

pascal ComponentResult SGGrabFrameComplete (SGChannel c,
                                         short bufferNum,
                                         Boolean *done);
c
Specifies the reference that identifies the channel for this operation. The sequence grabber provides this value to your grab-complete function.
bufferNum
Identifies the buffer. The sequence grabber provides this value to your grab-complete function.
done
Contains a pointer to a Boolean value. The SGGrabFrameComplete function sets this Boolean value to indicate whether the frame has been completely captured. The function sets the Boolean value to true if the capture is complete, and sets it to false if the capture is incomplete. The sequence grabber provides this pointer to your grab-complete function.

SPECIAL CONSIDERATIONS

You should call the SGGrabFrameComplete function only from your grab-complete function. If you call it at any other time, results are unpredictable.

RESULT CODE

cantDoThatInCurrentMode

-9402

Request invalid in current mode

SEE ALSO

See "Application-Defined Functions," which begins on Application-Defined Functions , for details about grab-complete functions.

SGDisplayFrame

The SGDisplayFrame function provides the default behavior for your display function .

pascal ComponentResult SGDisplayFrame (SGChannel c,
                                         short bufferNum,
                                         const MatrixRecord *mp,
                                         RgnHandle clipRgn);
c
Specifies the reference that identifies the channel for this operation. The sequence grabber component provides this value to your display function.
bufferNum
Identifies the buffer. The sequence grabber component provides this value to your display function.
mp
Contains a pointer to a transformation matrix for the display operation. If there is no matrix for the operation, set this parameter to nil .
clipRgn
Contains a handle to the clipping region for the destination image. This region is defined in the destination coordinate system. If there is no clipping region, set this parameter to nil .

SPECIAL CONSIDERATIONS

You should call the SGDisplayFramefunction only from your display function. If you call it at any other time, results are unpredictable.

RESULT CODE

cantDoThatInCurrentMod e

-9402

Request invalid in current mode

SEE ALSO

See "Application-Defined Functions," which begins on Application-Defined Functions , for details about display functions.

SGCompressFrame

The SGCompressFrame function provides the default behavior for your compress function.

pascal ComponentResult SGCompressFrame (SGChannel c,
                                         short bufferNum);
c
Specifies the reference that identifies the channel for this operation. The sequence grabber provides this value to your compress function.
bufferNum
Identifies the buffer. The sequence grabber provides this value to your compress function.

SPECIAL CONSIDERATIONS

You should call the SGCompressFrame function only from your compress function. If you call it at any other time, results are unpredictable.

RESULT CODES

cantDoThatInCurrentMode

-9402

Request invalid in current mode

Image Compression Manager errors

SEE ALSO

See "Application-Defined Functions," which begins on Application-Defined Functions , for information about compress functions.

SGCompressFrameComplete

The SGCompressFrameComplete function provides the default behavior for your compress-complete function.

pascal ComponentResult SGCompressFrameComplete (SGChannel c,
                                         short bufferNum,
                                         Boolean *done,
                                         SGCompressInfo *ci);
c
Specifies the reference that identifies the channel for this operation. The sequence grabber component provides this value to your compress-complete function.
bufferNum
Identifies the buffer. The sequence grabber component provides this value to your compress-complete function.
done
Contains a pointer to a Boolean value. The SGCompressFrameComplete function sets this Boolean value to indicate whether the frame has been completely compressed. The function sets the Boolean value to true if the compression is complete; it sets the Boolean value to false if the operation is incomplete. The sequence grabber component provides this pointer to your compress-complete function.
ci
Contains a pointer to a compression information structure (defined by the SGCompressInfo data type). If the compression is complete, the function completely formats this structure with information that is appropriate to the frame just compressed. See "The Compression Information Structure," for a description of this structure. The sequence grabber component provides this pointer to your compress-complete function.

SPECIAL CONSIDERATIONS

You should call the SGCompressFrameComplete function only from your compress-complete function. If you call it at any other time, results are unpredictable.

RESULT CODES

cantDoThatInCurrentMode

-9402

Request invalid in current mode

Image Compression Manager errors

SEE ALSO

See "Application-Defined Functions," which begins on Application-Defined Functions , for information about compress-complete functions.

SGAddFrame

The SGAddFrame function provides the default behavior for your add-frame function .

pascal ComponentResult SGAddFrame (SGChannel c, short bufferNum,
                                          TimeValue atTime,
                                         TimeScale scale,
                                         const SGCompressInfo *ci);
c
Specifies the reference that identifies the channel for this operation. The sequence grabber component provides this value to your add-frame function.
bufferNum
Identifies the buffer. The sequence grabber component provides this value to your add-frame function.
atTime
Specifies the time at which the frame was captured, in the time scale specified by the scale parameter. The sequence grabber component provides this value to your add-frame function. Your add-frame function can change this value before calling the SGAddFrame function. You can determine the duration of a frame by subtracting its capture time from the capture time of the next frame in the sequence.
scale
Specifies the time scale of the movie. The sequence grabber component provides this value to your add-frame function.
ci
Contains a pointer to a compression information structure (defined by the SGCompressInfo data type). This structure contains information describing the compression characteristics of the image to be added to the movie. See "The Compression Information Structure," for a description of this structure. The sequence grabber component provides this structure to your add-frame function.

SPECIAL CONSIDERATIONS

You should call the SGAddFrame function only from your add-frame function. If you call it at any other time, results are unpredictable.

RESULT CODES

cantDoThatInCurrentMode

-9402

Request invalid in current mode

Memory Manager errors

SEE ALSO

See "Application-Defined Functions," which begins on Application-Defined Functions , for information about add-frame functions.

SGTransferFrameForCompress

The SGTransferFrameForCompress function provides the default behavior for your transfer-frame function.

pascal ComponentResult SGTransferFrameForCompress (SGChannel c,
                                         short bufferNum,
                                         const MatrixRecord *mp,
                                         RgnHandle clipRgn);
c
Specifies the reference that identifies the channel for this operation. The sequence grabber component provides this value to your transfer-frame function.
bufferNum
Identifies the buffer. The sequence grabber component provides this value to your transfer-frame function.
mp
Contains a pointer to a transformation matrix for the transfer operation. If there is no matrix for the operation, set this parameter to nil .
clipRgn
Contains a handle to the clipping region for the destination image. This region is defined in the destination coordinate system. If there is no clipping region, set this parameter to nil .

SPECIAL CONSIDERATIONS

You should call the SGTransferFrameForCompress function only from your transfer-frame function. If you call it at any other time, results are unpredictable.

RESULT CODE

cantDoThatInCurrentMode

-9402

Request invalid in current mode

SEE ALSO

See "Application-Defined Functions," which begins on Application-Defined Functions , for information about transfer-frame functions.

SGGrabCompressComplete

The SGGrabCompressComplete function provides the default behavior for your grab-compress-complete function.

pascal ComponentResult SGGrabCompressComplete (SGChannel c,
                                         Boolean *done,
                                         SGCompressInfo *ci,
                                         TimeRecord *tr);
c
Identifies the channel for this operation. The sequence grabber provides this value to your grab-compress-complete function.
done
Contains a pointer to a Boolean value. The SGGrabCompressComplete function sets this value to true when it is done; it sets it to false if the operation is incomplete. The sequence grabber provides this pointer to your grab-compress-complete function.
ci
Contains a pointer to a compression information structure. When the operation is complete, the SGGrabCompressComplete function fills in this structure with information about the compression operation. The format and content of this structure are discussed earlier in this chapter, beginning on The Compression Information Structure .
The sequence grabber provides this pointer to your grab-compress-complete function.
tr
Contains a pointer to a time record. When the operation is complete, the SGGrabCompressComplete function uses this structure to indicate when the frame was grabbed. The format and content of this structure are discussed in the chapter "Movie Toolbox" in Inside Macintosh: QuickTime .
The sequence grabber provides this pointer to your grab-compress-complete function.

SPECIAL CONSIDERATIONS

You should call the SGGrabCompressComplete function only from your grab-compress-complete function. If you call it at other times, results are unpredictable.

RESULT CODE

cantDoThatInCurrentMode

-9402

Request invalid in current mode

SEE ALSO

See "Application-Defined Functions," for information about grab-compress-complete functions.

SGDisplayCompress

The SGDisplayCompress function provides the default behavior for your display-compress function.

pascal ComponentResult SGDisplayCompress (SGChannel c,
                                         Ptr dataPtr,
                                         ImageDescriptionHandle desc,
                      MatrixRecord *mp,
                                         RgnHandle clipRgn);
c
Identifies the channel for this operation. The sequence grabber provides this value to your display-compress function.
dataPtr
Contains a pointer to the compressed image data. The sequence grabber provides this pointer to your display-compress function.
desc
Specifies a handle to the image description structure to use for the decompression operation. The sequence grabber provides this handle to your display-compress function.
mp
Contains a pointer to a matrix structure. This matrix structure contains the transformation matrix to use when displaying the image. If there is no matrix for the operation, set this parameter to nil .
clipRgn
Contains a handle to the clipping region for the destination image. This region is defined in the destination coordinate system. If there is no clipping region, set this parameter to nil .

SPECIAL CONSIDERATIONS

You should call the SGDisplayCompress function only from your display-compress function. If you call it at other times, results are unpredictable.

RESULT CODE

cantDoThatInCurrentMode

-9402

Request invalid in current mode

SEE ALSO

See the next section, "Application-Defined Functions," for information about display-compress functions.


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next